<?php
	class CustomerCRUDController
	{   
		function save()
		{	
			$id=getFormValue('id');
			if(isset($id))
			$customer=R::load('customer',$id);
			else                            
			$customer=R::dispense('customer');
                    
			$customer->import($_POST, 'first_name,last_name,email,phone,address1,address2,city,state,zip');
			$id=R::store($customer);
                        var_dump($id);
			$_POST=array();
			$_POST['id']=$id;
		}
		
		function delete()
		{	
			$id=getFormValue('id');
			if(isset($id))
			{
				$customer=R::load('customer',$id);
				R::trash( $customer ); //for one bean
			}	
		}
		
		
	}